<?
function sendContactFollowUpEmail($email,$notes,$contactID) {
	global $dbname, $db, $db_selected;
	
	if (empty($notes)) {
		$notes = '[None entered]';
	}
	
	/*
	 * Get some information about this contact
	 */
	$sql = "SELECT C.IDNumber,C.DateofContact,C.SubjectLine,S.StaffFName,S.StaffLName 
			FROM cdc_Contacts C
			LEFT JOIN cdc_Users S ON S.StaffID = C.UseridEntry
			WHERE C.ContactID = '$contactID'";
	$result = mysql_db_query($dbname,$sql);
	$row = mysql_fetch_assoc($result);
	
	$idNumber    = $row['IDNumber'];
	$subject     = stripslashes($row['SubjectLine']);
	$staffName   = $row['StaffFName'].' '.$row['StaffLName'];
	/*
	 * Convert date
	 */
	$dateOfContact = new Zend_Date($row['DateofContact'], Zend_Date::ISO_8601, 'en_US');
	$newDate = $dateOfContact->toString('MMM d, Y h:m a');
	
	$message  = 'Hello,'.Chr(10).'You have been selected to follow up with the following contact:'.Chr(10).Chr(10);
	$message .= '  Contact ID #: '.$idNumber.Chr(10);
	$message .= '  Date:         '.$newDate.Chr(10);
	$message .= '  Subject:      '.$subject.Chr(10);
	$message .= '  Entered By:   '.$staffName.Chr(10);
	$message .= '  Notes:        '.$notes.Chr(10).Chr(10);
	$message .= '-------------------------------------------------------------------'.Chr(10);
	$message .= 'Click the following link to view this contact:'.Chr(10);
	$message .= 'http://www.childdisabilityconnection.org/admin/viewContact.php?contactID='.$contactID.Chr(10).Chr(10);
	$subject = 'Contact ID: '.$idNumber.' Follow-up Information';
	
	$mail = new Zend_Mail();
	$mail->setBodyText($message);
	$mail->setFrom(MASTER_MAIL, MASTER_MAIL_FROM);
	$mail->setSubject($subject);
	
	if (is_array($email)) {
		foreach($email as $emailAddress) {
			$mail->addTo($emailAddress);
		}
	} else {
		$mail->addTo($email);
	}
	
	$mail->send();	
}

function sendNewUserEmail($userID) {
	
	global $dbname, $db, $db_selected;
	
	if ($userType == 'userStaff') {
		
	} elseif($userType == 'userSharedResource') {
		
	}
	
	$idNumber    = $row['IDNumber'];
	$subject     = stripslashes($row['SubjectLine']);
	$staffName   = $row['StaffFName'].' '.$row['StaffLName'];
	/*
	 * Convert date
	 */
	$dateOfContact = new Zend_Date($row['DateofContact'], Zend_Date::ISO_8601, 'en_US');
	$newDate = $dateOfContact->toString('MMM d, Y h:m a');
	
	$message  = 'Hello,'.Chr(10).'You have been selected to follow up with the following contact:'.Chr(10).Chr(10);
	$message .= '  Contact ID #: '.$idNumber.Chr(10);
	$message .= '  Date:         '.$newDate.Chr(10);
	$message .= '  Subject:      '.$subject.Chr(10);
	$message .= '  Entered By:   '.$staffName.Chr(10);
	$message .= '  Notes:        '.$notes.Chr(10).Chr(10);
	$message .= '-------------------------------------------------------------------'.Chr(10);
	$message .= 'Click the following link to view this contact:'.Chr(10);
	$message .= 'http://www.childdisabilityconnection.org/admin/viewContact.php?contactID='.$contactID.Chr(10).Chr(10);
	echo $message;
	$subject = 'Contact ID: '.$idNumber.' Follow-up Information';
	
	$mail = new Zend_Mail();
	$mail->setBodyText($message);
	$mail->setFrom(MASTER_MAIL, MASTER_MAIL_FROM);
	$mail->setSubject($subject);
	
	if (is_array($email)) {
		foreach($email as $emailAddress) {
			$mail->addTo($emailAddress);
		}
	} else {
		$mail->addTo($email);
	}
	
	$mail->send();	
}

function sendMessageEmail($staffIDTo,$message) {
	global $dbname, $db, $db_selected;
}
?>